//
//  ZHSelectClassifyHeaderView.m
//  sc-cyan-ios
//
//  Created by lj on 2018/1/2.
//  Copyright © 2018年 greenbuilding. All rights reserved.
//

#import "ZHSelectClassifyHeaderView.h"

#import "ZHSelectClassify.h"

@interface ZHSelectClassifyHeaderView()
//行选择按钮
@property (weak, nonatomic) IBOutlet UIButton *rowBtn;
//加减号文字
@property (weak, nonatomic) IBOutlet UILabel *addL;
//标题
@property (weak, nonatomic) IBOutlet UILabel *titleL;
//全选按钮
@property (weak, nonatomic) IBOutlet UIButton *selBtn;

@end

@implementation ZHSelectClassifyHeaderView

- (void)awakeFromNib{
    [super awakeFromNib];
    
    self.autoresizingMask = UIViewAutoresizingNone;
}

- (void)setSection:(NSInteger)section{
    _section = section;
    
    _rowBtn.tag = section;
    _selBtn.tag = section;
}

- (void)setClassify:(ZHSelectClassify *)classify{
    _classify = classify;
    _selBtn.selected = classify.isSel;
    _addL.text = classify.isShow ? @"-" : @"+";
}

//行选择按钮触发事件
- (IBAction)rowBtnAction:(UIButton *)sender {
    if ([self.delegate respondsToSelector:@selector(selectClassifyHeaderView:didSelectedeRowButton:)]) {
        [self.delegate selectClassifyHeaderView:self didSelectedeRowButton:sender];
    }
}
//全选按钮触发事件
- (IBAction)selBtnAction:(UIButton *)sender {
    if ([self.delegate respondsToSelector:@selector(selectClassifyHeaderView:didSelectedeSelectedAllButton:)]) {
        [self.delegate selectClassifyHeaderView:self didSelectedeSelectedAllButton:sender];
    }
}

@end
